export const typeOptions = [
	{
		label: '设计表单',
		value: 0
	},
	{
		label: '系统表单',
		value: 1
	}
]
export const typeOptions_config = typeOptions.reduce((res, v) => {
	res[v.value] = v.label
	return res
}, {} as { [key: string]: string })

export const statusOptions = [
	{
		label: '禁用',
		value: 0
	},
	{
		label: '正常',
		value: 1
	}
]
export const statusOptions_config = statusOptions.reduce((res, v) => {
	res[v.value] = v.label
	return res
}, {} as { [key: string]: string })

// 新增编辑表单模板
export const templateForms = [
	{
		prop: 'formCategoryId',
		label: '所属表单分类',
		itemType: 'select',
		filterable: true,
		options: [],
		rules: [{ required: true, message: '请选择所属表单分类', trigger: 'blur' }]
	},
	{
		prop: 'name',
		label: '模板名称',
		itemType: 'input',
		rules: [{ required: true, message: '请输入模板名称', trigger: 'blur' }]
	},
	{
		prop: 'code',
		label: '模板编码',
		itemType: 'input',
		rules: [{ required: true, message: '请输入模板编码', trigger: 'blur' }]
	},
	{
		prop: 'type',
		label: '类型',
		itemType: 'radio',
		options: typeOptions
	},
	{
		prop: '_box',
		props: ['pcUrl', 'appUrl'],
		itemType: 'render',
		labelWidth: '0px',
		style: 'margin-bottom: 0',
		render: (extendsParams: any) => {
			const { form, params } = extendsParams
			// 系统表单
			if (params.type === 1) {
				const rules_1 = [{ required: true, message: '请输入PC端地址', trigger: 'blur' }]
				return [
					<el-form-item prop="pcUrl" label="PC端地址" rules={rules_1} style="width:100%">
						<el-input v-model={params.pcUrl} />
					</el-form-item>,
					<el-form-item prop="appUrl" label="APP端地址" style="width:100%;">
						<el-input v-model={params.appUrl} />
					</el-form-item>
				]
			}
			return ''
		}
	},
	{
		prop: 'status',
		label: '状态',
		itemType: 'switch',
		activeText: '正常',
		inactiveText: '禁用'
	},
	{
		prop: 'sort',
		label: '排序',
		itemType: 'inputNumber',
		rules: [{ required: true, message: '请输入排序', trigger: 'blur' }]
	},
	{
		prop: 'remark',
		label: '备注',
		itemType: 'input'
	}
]
